package com.hj.mp.demo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hj.mp.demo.entity.OwnUser;
import com.hj.mp.demo.mapper.OwnUserMapper;
import com.hj.mp.demo.service.IOwnUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.List;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author jobob
 * @since 2020-04-01
 */
@Service
public class OwnUserServiceImpl extends ServiceImpl<OwnUserMapper, OwnUser> implements IOwnUserService {

    @Autowired
    private OwnUserMapper ownUserMapper;

    @Override
    public boolean insert(OwnUser ownUser) {
        return ownUserMapper.insert(ownUser) > 0;
    }

    @Override
    public boolean del(String id) {
        return ownUserMapper.deleteById(id) >0;
    }

    @Override
    public boolean update(OwnUser ownUser) {
        return ownUserMapper.updateById(ownUser) > 0;
    }

    @Override
    public OwnUser selectById(String id) {
        return ownUserMapper.selectById(id);
    }

    @Override
    public PageInfo<OwnUser> queryList(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<OwnUser> userList = ownUserMapper.queryList();
        PageInfo page = new PageInfo(userList);
        return page;
    }
}
